<?php
session_start();
	$status = isset($_GET['ideal']['status']) ? $_GET['ideal']['status'] : '';
	if(strcmp($status, 'cancel') === 0)
	{
		// Notify user
		#$status ='done';
		header('Location: test.php?result=cancel');
		#echo "<meta http-equiv=\"refresh\" content=\"0;URL=testResult1.php\">";
	}
	elseif(strcmp($status, 'error') === 0)
	{
		// Notify user
		#$status ='';
		header('Location: test.php?result=error');
		#echo "<meta http-equiv=\"refresh\" content=\"0;URL=testResult2.php\">";
	}
	elseif(strcmp($status, 'success') === 0)
	{
		include('include/db_connect.php');
		// Notify user
		// hier Inserten, en aflaten hangen of er door wordt verwezen naar de result pagina
		#hier komen benodigde gegevens: userid, productid, prijs,aantal,bestellingid
		$userid = $_SESSION['userID'];
		$bezorgtype = $_SESSION['bezorg'];
		$orderIdQuery = mysql_query("SELECT idBESTELLING FROM BESTELLING ORDER BY idBESTELLING DESC LIMIT 1");
		if(!$orderIdQuery) 
		{
			die("Query failed. Please try again later.<br>".mysql_error());
		} 
		else 
		{
			$orderIdResult = mysql_fetch_assoc($orderIdQuery );
			$orderid = $orderIdResult['idBESTELLING']+1;
			//echo $orderid;
			$bestellingQuery="INSERT INTO `m1_f4502769`.`BESTELLING` (`idBESTELLING`, `USERNAME_idUSERNAME`, `datum_geplaatst`, `datum_geannuleerd`, `datum_verzonden`,`bezorgtype`)".
			"VALUES('$orderid', '$userid', now(), NULL, NULL,'$bezorgtype')";
			$bestellingInsert = mysql_query($bestellingQuery) or die(mysql_error());
			#$bestellingInsert = true;
			if($bestellingInsert)
			{
				
				foreach($_SESSION['cart']as $id =>$x)	
				{
					$result = mysql_query("SELECT idPRODUCT,prijs,korting FROM PRODUCT WHERE idPRODUCT=$id");
					$myrow = mysql_fetch_assoc($result);
					$prijs = $myrow['prijs'];
					$korting = $myrow['korting'];
					$prijs = $prijs * ((100-$korting)/100);
					$productid = $myrow['idPRODUCT'];
					echo $orderid.'<br>';
					echo $_SESSION['userID'].'<br>';
					echo 'productid: '.$productid.'<br>';
					$prijs =number_format($prijs,2,'.','');	
					echo 'prijs: '.$prijs.'<br>';
					echo 'aantal: '.$x.'<br>';
					
					$BestelQuery = "INSERT ".
									"INTO `m1_f4502769`.`BESTELLING_has_PRODUCT` ".
									"(`BESTELLING_idBESTELLING` ,`BESTELLING_USERNAME_idUSERNAME` ,`PRODUCT_idPRODUCT` ,`aantal` ,`prijs`)".
									"VALUES".
									"('$orderid', '$userid', '$productid', '$x', '$prijs')";
									echo $BestelQuery.'<br>';
					$BestelInsert = mysql_query($BestelQuery);
				}
					
				header('Location: test.php?result=success');
								
			}
			else
			{
				echo "De query kon niet uitgevoerd worden!";
			}
			

		}			

	}
		
?>
<html><head>

	<script type="text/javascript" src="admin/ckeditor_3.5.2/ckeditor/ckeditor.js"></script>
	
</head>
<?php 
	include('include/db_connect.php');
	include("include/header.php");
	include("include/menu.php"); 
?>	
<script type="text/javascript">
function onload() { toonDag(0); } 
function toonDag(dagId){
	var dagen = getElementsByClass('programma');
	
	for (i=0; i < dagen.length; i++)
		{
			dagen[i].style.display = "none";
			document.getElementById('knopDag'+(i+1)).style.color = "#000000";
			document.getElementById('knopDag'+(i+1)).style.backgroundColor = "transparent";
		}
	dagen[dagId].style.display = "block";
	var knopId = 'knopD' + dagen[dagId].id.substr(1);
	document.getElementById(knopId).style.color = "#ffffff";
	document.getElementById(knopId).style.backgroundColor = "#000000";
	if(typeof hideSecties == 'function') { hideSecties() };
}




function getElementsByClass(theClass) {
	var allHTMLTags = new Array();
	var elementsOfClass = new Array();
	var allHTMLTags=document.getElementsByTagName("*");		//Create Array of All HTML Tags
	
	for (i=0; i<allHTMLTags.length; i++) {					//Loop through all tags using a for loop
		
		if (allHTMLTags[i].className==theClass) {			//Get all tags with the specified class name.
			elementsOfClass.push(allHTMLTags[i]);			//Push them into an Array
		}
	}
	return elementsOfClass;
}
</script>
<style type="text/css">
.knopDag{
	padding-top: 5px;
	padding-bottom: 2px;
	padding-right: 7px;
	padding-left: 7px;
	border-color: black;
	border-right-width: 0px;
	border-left-width: 0px;
	border-bottom-width: 2px;
	border-top-width: 0px;
	display: inline;
	border-style: solid;
	font-size: 1.5em;
	font-weight: bold;

}

#knopDagWrap{
	margin-top:10px;
	width:500px;
	margin-left:auto;
	margin-right:auto;
	margin-bottom: 15px;
	padding-bottom: 2px;
	border-color: black;
	border-style: solid;
	text-align: center;
	border-right-width: 0px;
	border-left-width: 0px;
	border-top-width: 0px;
	border-bottom-width: 2px;
}

#dagen{
	padding-right: 10px;
	padding-left: 10px;
}

.programma .datum{
	margin-bottom: 10px;
}

.programma .progLijst div{
	padding-top: 3px;
	margin-top: 5px;
	border-right-width: 0px;
	border-left-width: 0px;
	border-top-width: 1px;
	border-color: #999999;
	border-bottom-width: 0px;
	border-style: solid;
}

</style>
<!--<body onLoad="javascript:toonDag(0);">-->
<?php
	$toggleDag = "toonDag(0)";
	
if(!isset($_POST['submit']) || $_POST['submit']=="")
{	
	if(isset($_GET['result'])){
	$toggleDag = "toonDag(5)";
	
	}
	else
	{
		$toggleDag = "toonDag(0)";
	}
}
else if(isset($_POST['submit']))
{	
	if($_POST['submit']=="dag2")
	{
		$toggleDag = "toonDag(1)";
		$_POST['submit'] = "";
	}
	if($_POST['submit']=="dag3"){
		$toggleDag = "toonDag(2)";
		$_POST['submit'] = "";
	}
	if($_POST['submit']=="dag4"){
		$toggleDag = "toonDag(3)";
		$_POST['submit'] = "";
	}
	if($_POST['submit']=="dag5"){
		$toggleDag = "toonDag(4)";
		$_POST['submit'] = "";
	}
}

	
?>

<?php echo '<body onload="javascript:'.$toggleDag.';">';
?>
<div id="main_content" >
  
<?php
				if($_SESSION['logged'])
				{
					echo '<div id="knopDagWrap">';
					#echo '<a href="#" onclick="toonDag(0); return false;" ><span class="knopDag" id="knopDag1">Bestelling</span></a>';
					#echo '<a href="#" onclick="toonDag(1); return false;" ><span class="knopDag" id="knopDag2">Adres</span></a>';
					#echo '<a href="#" onclick="toonDag(2); return false;" ><span class="knopDag" id="knopDag3">Controle</span></a>';
					#echo '<a href="#" onclick="toonDag(3); return false;" ><span class="knopDag" id="knopDag4">Betaling</span></a>'; 
					#echo '<a href="#" onclick="toonDag(4); return false;" ><span class="knopDag" id="knopDag5">Verzenden</span></a>'; 
					#echo '<a href="#" onclick="toonDag(5); return false;" ><span class="knopDag" id="knopDag6">Bevestiging</span></a>'; 
					echo '<span class="knopDag" id="knopDag1">Bestelling</span>';
					echo '<span class="knopDag" id="knopDag2">Adres</span>';
					echo '<span class="knopDag" id="knopDag3">Controle</span>';
					echo '<span class="knopDag" id="knopDag4">Betaling</span>'; 
					echo '<span class="knopDag" id="knopDag5">Verzenden</span>'; 
					echo '<span class="knopDag" id="knopDag6">Bevestiging</span>'; 
					echo '</div> <!-- end knopDagWrap -->';
					
					echo '<div id="dagen">';

					echo '<div class="programma" id="dag1">';
					echo '<form name="bezorgen" action="test.php" method="POST">';
//					echo "<table border =1 cellspacing = 3 cellpadding = 0 width ='500'>";
					echo '<table border="0" cellspacing="3" cellpadding="0" width="450" style="margin-left:auto; margin-right: auto">';
					echo '<p style="font-size:12px">Controleer of uw bestelling klopt. Zo niet, ga terug naar de winkelwagen. Start het bestelproces daarna opnieuw.</p>';						
					$total = 0;
					echo '<tr>';
					echo "<th align='left'>Naam</th>";
					echo "<th align='right'>Aantal</th>";
					echo "<th align='right'>Prijs </th>";
					echo "</tr>";

					foreach($_SESSION['cart']as $id =>$x)
					{
						$result = mysql_query("SELECT naam,prijs,korting FROM PRODUCT WHERE idPRODUCT=$id");
						$myrow = mysql_fetch_assoc($result);
						$name = $myrow['naam'];
						$name = substr($name,0,40);
						$price = $myrow['prijs'];
						$korting = $myrow['korting'];
						$price= $price* ((100-$korting)/100);
						$line_cost = $price * $x;
						$total = $total+$line_cost;
						$line_cost = number_format($line_cost,2,',','');
						$total = number_format($total,2,',','.');
						echo '<tr>';
						echo "<td align='left'> $name </td>";
						echo "<td align='right'>$x</td>";
						echo "<td align='right'> &euro; $line_cost</td>";
						echo "</tr>";
					}
					echo "<tr>";
					echo "<td align='right'><br>Totale prijs:</td>";
					echo "<td align='right'><b><br>&euro; $total</b></td>";
					echo '</table>';
					echo '<button type="submit" name="submit" value="dag2">Volgende</button>';
					echo '</form>';
					echo '</div>';
					

					echo '<div class="programma" id="dag2">';?>
					<?php
					echo '<form action="test.php" method="POST">';
					$Bestellinggegevens = "SELECT ".
					  "voornaam, ".
					  "tussenvoegsel, ".
					  "achternaam, ".
					  "email, ".
					  "postcode, ".
					  "straat_naam, ".
					  "huis_nummer, ".
					  "toevoeging, ".
					  "woonplaats ".
					  "FROM ADRES, USER_DATA ".
					  "WHERE USERNAME_idUSERNAME =".$_SESSION['userID'].
					  " AND USER_DATA.ADRES_idADRES = ADRES.idADRES";
					  //echo $Bestellinggegevens;
					  $result = mysql_query($Bestellinggegevens) or die(mysql_error());
					  $myrow = mysql_fetch_assoc($result);

					echo "<table border =0 cellspacing = 0 cellpadding = 0 width ='250' >";
						echo '<p style="font-size:9px">BestPC is niet verantwoordleijk als een bestelling fout gaat wanneer de gegevens die we van u hebben niet kloppen</p>';
					echo "<tr>";
						echo '<td>Uw Gegevens:</td>';
					echo '<p style="font-size:12px">Kloppen uw gegevens niet, <a href="account.php">klik hier</a> om de gegevens te veranderen, en start het bestelproces opnieuw</p>';						
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Voornaam: </th>";
						echo "<td align='left'>".$myrow['voornaam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Tussenvoegsel: </th>";
						echo "<td align='left'>".$myrow['tussenvoegsel']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Achternaam: </th>";
						echo "<td align='left'>".$myrow['achternaam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Straat: </th>";
						echo "<td align='left'>".$myrow['straat_naam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Huisnummer: </th>";
						echo "<td align='left'>".$myrow['huis_nummer']."</td>";
					echo "</tr>";	
					echo "<tr>";
						echo "<th align='right'>Toevoeging: </th>";
						echo "<td align='left'>".$myrow['toevoeging']."</td>";
					echo "</tr>";	
					echo "<tr>";
						echo "<th align='right'>Stad:</th>";
						echo "<td align='left'>".$myrow['woonplaats']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Email*:</th>";
						echo "<td align='left'>".$myrow['email']."</td>";
					echo "</tr>";
					echo '<tr>';

					echo '</tr>';
					echo "</table>";
					echo "<table>";
					echo "<tr>";
						echo "<th align='center'>Selecteer de bezorgmethode:</th>";
					echo "</tr>";
					echo "<tr>";
						echo '<td><input type="radio" name="bezorgmethode" value="Post" CHECKED>Post</td>';
					echo "</tr>";
					echo "<tr>";
						echo '<td><input type="radio" name="bezorgmethode" value="Afhaal">Afhalen distributiecentrum</td>';
					echo "</tr>";
					echo "</table>";
					echo '<td><p style="font-size:9px">*Zorg ervoor dat het emailadres klopt, want er wordt een bevestiging van de bestelling naartoe gestuurd</p></td>';
					echo '<p style="font-size:9px">BestPC is niet verantwoordleijk als een bestelling fout gaat wanneer de gegevens die we van u hebben niet kloppen</p>';
					echo '<button type="submit" name="submit" value="dag1">Vorige</button>';
					echo '<button type="submit" name="submit" value="dag3">Volgende</button>';
					echo '</form>';
					echo '</div>';
					?>
			
			
					<div class="programma" id="dag3">
					
					<?php echo '<form name = "test" action="test.php" method="POST">';?>
					<script type="text/javascript"> function toggle(){ 	
					if(document.test["zend"].disabled==true) { document.test["zend"].disabled=false;}
					else{document.test["zend"].disabled=true; } 
					} 
					function toggle2(){
					if(document.getElementById('voorwaarden').checked) {
					document.getElementById('vooruit').disabled = false;
					}
					else
					{
					document.getElementById('vooruit').disabled = true;
					}
					}
					</script> 
					<?php
					echo '<p style="font-size:12px; text-align:center"> Hier zijn de gegevens op een rijtje. controleer ze goed, en ga dan pas verder</p>';
					echo '<table border="0" cellspacing="3" cellpadding="0" width="450" style="margin-left:auto; margin-right: auto">';
					$total = 0;
					echo '<tr>';
					echo "<th align='left'>Naam</th>";
					echo "<th align='right'>Aantal</th>";
					echo "<th align='right'>Prijs </th>";
					echo "</tr>";

					foreach($_SESSION['cart']as $id =>$x)
					{
						$result = mysql_query("SELECT naam,prijs,korting FROM PRODUCT WHERE idPRODUCT=$id");
						$myrow = mysql_fetch_assoc($result);
						$name = $myrow['naam'];
						$name = substr($name,0,40);
						$price = $myrow['prijs'];
						$korting = $myrow['korting'];
						$price= $price* ((100-$korting)/100);
						$line_cost = $price * $x;
						$total = $total+$line_cost;
						#$line_cost = number_format($line_cost,2,',','.');
						#$total = number_format($total,2,',','.');
						echo '<tr>';
						echo "<td align='left'> $name </td>";
						echo "<td align='right'>$x</td>";
						echo "<td align='right'> &euro; $line_cost</td>";
						echo "</tr>";
						}

						$_SESSION ['fOrderAmount']= $total ;
						echo "<tr>";
						echo "<td align='right'><br>Totale prijs:</td>";
						echo "<td align='right'><b><br>&euro; $total</b></td>";

					echo '</table>';
					
					$Bestellinggegevens = "SELECT ".
					  "voornaam, ".
					  "tussenvoegsel, ".
					  "achternaam, ".
					  "email, ".
					  "postcode, ".
					  "straat_naam, ".
					  "huis_nummer, ".
					  "toevoeging, ".
					  "woonplaats ".
					  "FROM ADRES, USER_DATA ".
					  "WHERE USERNAME_idUSERNAME =".$_SESSION['userID'].
					  " AND USER_DATA.ADRES_idADRES = ADRES.idADRES";
					  //echo $Bestellinggegevens;
					  $result = mysql_query($Bestellinggegevens) or die(mysql_error());
					  $myrow = mysql_fetch_assoc($result);

					
					echo "<table border =0 cellspacing = 3 cellpadding = 0 width ='250' >";
					
					echo "<tr>";
					echo '<th>Uw Gegevens:</th>';
					
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Voornaam: </th>";
						echo "<td align='left'>".$myrow['voornaam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Tussenvoegsel: </th>";
						echo "<td align='left'>".$myrow['tussenvoegsel']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Achternaam: </th>";
						echo "<td align='left'>".$myrow['achternaam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Straat: </th>";
						echo "<td align='left'>".$myrow['straat_naam']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Huisnummer: </th>";
						echo "<td align='left'>".$myrow['huis_nummer']."</td>";
					echo "</tr>";	
					echo "<tr>";
						echo "<th align='right'>Toevoeging: </th>";
						echo "<td align='left'>".$myrow['toevoeging']."</td>";
					echo "</tr>";	
					echo "<tr>";
						echo "<th align='right'>Stad:</th>";
						echo "<td align='left'>".$myrow['woonplaats']."</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<th align='right'>Email*:</th>";
						echo "<td align='left'>".$myrow['email']."</td>";
					echo "</tr>";
					echo '<tr>';

						echo '</tr>';
						echo "</table>";
						echo "<table>";
							echo "<tr>";

							$bezorg = "	Post";
							if(isset($_POST['bezorgmethode'])){
								$bezorg = $_POST['bezorgmethode'];
							}
							$_SESSION['bezorg']=$bezorg;
							if($bezorg=="Post"){
							$bezorgkosten = $total+2;}
							elseif($bezorg=="Afhaal")
							{
							$bezorgkosten = $total;
							}
								echo "<th align='center'>Bezorgmethode:</th>";
								echo '<td>'.$bezorg.'</td>';
							echo "</tr>";
							echo "<th align ='center'>Prijs incl. bezorgkosten: ";
								echo '<td>&euro; '.$bezorgkosten.'</td>';
						echo "</table>";
						echo '<input type="checkbox" id="voorwaarden" name = "voorwaarden" onclick="javascript:toggle2();"><label for="voorwaarden">Accepteer de voorwaardes</label>';
						#	echo '<input type="submit" disabled="true" name="zend"> ';
						echo '<br>';
						echo '<button type="submit" name="submit" value="dag2">Vorige</button>';
						echo '<button type="submit" name="submit" disabled = "true" id = "vooruit" value="dag4">Volgende</button>';
					echo '</form>';

					echo '</div>';
					
					echo '<div class="programma" id="dag4">';
					#echo '<form name="bankselect">';
					#echo 'Kies uw bank:';
					#echo '<select name=bank onChange="document.bankselect.submit();">';
					#echo '<script src="https://www.targetpay.com/ideal/issuers-nl.js"></script>';
					#echo '</select>';
					#echo '</form>';

					#echo '<form action="../ideal/ideal-lite-example/step2.php" method="POST">';
					echo '<form action="test.php" method="POST">';
					$orderIDselect = "SELECT idBESTELLING FROM BESTELLING ORDER BY idBESTELLING DESC LIMIT 1";
					$resultOrderID = mysql_query($orderIDselect) or die(mysql_error());
					$fetchResult = mysql_fetch_assoc($resultOrderID);
					$orderid = $fetchResult['idBESTELLING'];
					$sOrderId = $orderid;
					$sOrderDescription = 'Webshop bestellingnummer: '.$orderid;
										
					$fOrderAmount = $_SESSION['fOrderAmount'];
					
					$_SESSION['sOrderId']= $orderid;
					$_SESSION['sOrderDescription'] = $sOrderDescription;
					
					#echo 'Orderid: '.$sOrderId;
					#echo'<br>' ;
					#echo 'Bedrag: '.$fOrderAmount;
					echo'<br>' ;
					#echo 'Beschrijving: '.$sOrderDescription;
					#echo '<p style="font-size:12px; text-align: center;">Hier wordt de betaling geregeld.</p>';						
					echo '<a href="http://www.ideal-simulator.nl/"><img src="images/style_images/ideal_logo2.jpg" alt="IDeal"></a><br><br>';
					echo '<button type="submit" name="submit" value="dag3">Vorige</button>';
					echo '<button type="submit" name="submit" value="dag5">Volgende</button>';
					#echo '<input name="submit" type="submit" value="dag5"></b></p>';
					#echo '<input name="submit" type="submit" value="verder &gt;&gt;"></b></p>';
					echo '</form>';

					echo '</div>';
					
					echo '<div class="programma" id="dag5">';
					echo 'Verzenden';
					if(function_exists('date_default_timezone_set'))
					{
						date_default_timezone_set('Europe/Amsterdam');
					}
					include('../ideal/ideal-lite-example/library/ideallite.cls.php');

					#$sOrderId = (empty($_POST['order_id']) ? '' : $_POST['order_id']);
					#$sOrderDescription = (empty($_POST['order_description']) ? '' : $_POST['order_description']); // Upto 32 characters
					#$fOrderAmount = floatval(empty($_POST['order_amount']) ? '' : str_replace(',', '.', $_POST['order_amount'])); 
					$fOrderAmount = $_SESSION['fOrderAmount'];
					$sOrderDescription = $_SESSION['sOrderDescription'];
					$sOrderId = $_SESSION['sOrderId'];
					$oIdeal = new IdealLite();
					
					$sCurrentUrl = strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, strpos($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['SERVER_NAME'] . '/') . substr($_SERVER['SCRIPT_NAME'], 1);
					$sReturnUrl = substr($sCurrentUrl, 0, strrpos($sCurrentUrl, '/') + 1) . 'test.php';

					// Set shop details
					$oIdeal->setUrlCancel($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=cancel');
					$oIdeal->setUrlError($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=error');
					$oIdeal->setUrlSuccess($sReturnUrl . '?ideal[order]=' . urlencode($sOrderId) . '&ideal[status]=success');
					
					// Set order details
					$oIdeal->setAmount($fOrderAmount);
					$oIdeal->setOrderId($sOrderId);
					$oIdeal->setOrderDescription($sOrderDescription);
					
					// Customize submit button
					$oIdeal->setButton('Betalen met iDEAL');
					
					// Generate form
					echo '<p>Uw bestelling afrekenen!</p>' . $oIdeal->createForm();
									
					#echo '<button type="submit" name="submit" value="dag4">Vorige</button>';
					#echo '<button type="submit" name="submit" value="dag6">Volgende</button>';
					echo '</div>';
					
					//laatste div!
					if(isset($_GET['result']))
					{
						$status = "";
						$status = $_GET['result'];
						
						unset($_GET['result']);
						if(strcmp($status, "cancel")==0)
						{
							// Notify user
							echo '<div class="programma" id="dag6">';
								echo 'Bevestiging en insert in de database';
								echo "<br>";
								echo '<h1>Transactie geannuleerd.</h1>';
								echo'<h2>U heeft de betaling van deze bestelling met iDEAL afgebroken.</h2>';
								echo '<h3><a href="test.php">Klik hier</a> om terug te gaan naar stap 1.</h3>';
							echo '</div>';
						}
						elseif(strcmp($status, "error")==0)
						{
							// Notify user
							echo '<div class="programma" id="dag6">';
								echo 'Bevestiging en insert in de database';
								echo "<br>";
								echo '<h1>Transactie fout.</h1>';
								echo '<br>';
								echo '<h2>Betalen met iDEAL is nu niet mogelijk.Probeer het later opnieuw of betaal op een andere manier. </h2>';
								echo '<p style="font-size:11px; text-align: center; margin-top: 25px;">Als u in uw Internetbankieren ziet dat de betaling van uw bestelling heeft plaatsgevonden, zullen wij zodra wij hiervan de bevestiging ontvangen tot levering overgaan.</p>';
								echo '<p style="font-size:11px; text-align: center; margin-top: 25px;"><a href="index.php">Klik hier</a> om terug te gaan naar de homepage.</p>';
								echo '<br>';
								echo '<h4>Indien deze fout blijft bestaan. <a href="mailto:someone@example.com?Subject=Hello%20again">Klik hier </a>om de winkelier in te lichten .</h4>';
							echo '</div>';
						}
						elseif(strcmp($status, "success")==0)
						{
							// Notify user
							echo '<div class="programma" id="dag6">';
								echo 'Bevestiging en insert in de database';
								echo "<br>";
								echo '<h1>Transactie geslaagd.</h1>';
								echo '<br>';
								echo'<h2>Uw betaling met iDEAL is geslaagd.</h2>';
								echo '<br>';
								echo '<br>';
								echo '<h3><a href="index.php">Klik hier om terug te gaan naar de homepage.</a></h3>';
							echo '</div>';
						}
						else
						{
							echo '<div class="programma" id="dag6">';
								echo 'Bevestiging en insert in de database';
								echo "<br>";
								// Notify user
								echo '<h1>Transactie fout.</h1>';
								echo '<h1>De status van uw iDEAL betaling is onbekend.</h1>';
								echo '<p><a href="test.php">Klik hier</a> om terug te gaan naar stap 1.</p>';
							echo '</div>';
						}
					}
				?>
				</div> <!-- end dagen -->
			
					
</div>
<?php 
}
else 
{
	header('Location: winkelwagen.php');
}	

?>
</body>
</html>